package sample.transaction.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sample.transaction.service.ITestService;
@Service
@Transactional(rollbackFor = Exception.class) //加在类上，则表示所有方法都会被事务管理，且抛异常则回滚
public class TestServiceImpl implements ITestService {
    @Transactional(rollbackFor = Exception.class) //加在方法上，表示该方法抛异常则回滚
    @Override
    public String test() {
        return null;
    }
}
